home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 2.0 KB | 95 lines | [TEXT/MPS ] |
- { requires SIOW }
-
- {
- This little program installs a slot VBL task for the
- main screen, even if the main screen uses built-in
- video, by getting the gdRefNum and calling GetDctlEntry
- to find the slot number.
-
- The VBL will run 5 times and then be dequeued.
-
- Requires the MPW SIOW standard I/O package.
-
- Grobbins 9/91
- }
-
- PROGRAM slotVInstallTest;
-
- USES OSUtils, Retrace, PasLibIntf, Devices;
-
- CONST kVBLCount = 60;
-
- TYPE
- enhVBLTask = RECORD
- theVBLTask: VBLTask;
- theGlobal: ^LongInt;
- END;
- enhVBLTaskPtr = ^enhVBLTask;
-
- VAR
- retCode: OSErr;
- response: LONGINT;
-
- myVBLTask: enhVBLTask;
- vblGlobalLongInt, tempLongInt: LONGINT;
-
- GDevHand: GDHandle;
- mainGDRefNum: INTEGER;
- DCEHand: AuxDCEHandle;
-
- FUNCTION getVBLRec: enhVBLTaskPtr;
- INLINE $2E88; { put A0 on stack }
-
- PROCEDURE myVBLProc;
- VAR
- theEnhVBLTaskRecPtr: enhVBLTaskPtr;
- BEGIN
- theEnhVBLTaskRecPtr := getVBLRec;
-
- theEnhVBLTaskRecPtr^.theGlobal^ :=
- theEnhVBLTaskRecPtr^.theGlobal^ + 1;
- { reset VBL }
- theEnhVBLTaskRecPtr^.theVBLTask.vblCount := kVBLCount;
- END;
-
- BEGIN
- GDevHand := GetMainDevice;
- IF GDevHand = NIL THEN BEGIN WriteLn('no main device!'); HALT; END;
-
- mainGDRefNum := GDevHand^^.gdRefNum;
-
- DCEHand := AuxDCEHandle(GetDctlEntry(mainGDRefNum));
- WriteLn('main slot is ',DCEHand^^.dCtlSlot);
-
-
- WriteLn( 'installing vbl...');
- PLFlush(output);
-
- { set up VBL task }
- myVBLTask.theVBLTask.qType := ORD(vType);
- myVBLTask.theVBLTask.vblAddr := @myVBLProc;
- myVBLTask.theVBLTask.vblCount := kVBLCount;
- myVBLTask.theVBLTask.vblPhase := 0;
- myVBLTask.theGlobal := @vblGlobalLongInt;
-
- vblGlobalLongInt := 0;
- tempLongInt := 0;
-
- retCode := SlotVInstall(@myVBLTask, DCEHand^^.dCtlSlot);
- IF retCode <> noErr THEN WriteLn( 'VInstall failed')
- ELSE BEGIN
- WriteLn('Installed.');
- PLFlush(output);
- REPEAT
- IF vblGlobalLongInt <> tempLongInt THEN
- BEGIN
- WriteLn ('vblGlobal = ',vblGlobalLongInt);
- PLFlush(output);
- tempLongInt := vblGlobalLongInt;
- END; { IF }
- UNTIL vblGlobalLongInt >= 5;
-
- retCode := SlotVRemove(@myVBLTask, DCEHand^^.dCtlSlot);
- END; { ELSE }
-
- END.